﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace draw
{
    public class LineXLD : UserControlX
    {
        PointF[] pointFs;
        public LineXLD(PointF[] _pointFs)
        {
            pointFs = _pointFs;
        }


        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            PointF[] m_pointFs = new PointF[pointFs.Length];
            pointFs.CopyTo(m_pointFs, 0);
            using (System.Drawing.Drawing2D.Matrix transform = e.Graphics.Transform)
            {
                transform.Scale(ScaleX, ScaleY, System.Drawing.Drawing2D.MatrixOrder.Append);
                transform.Translate(OffsetX, OffsetY, System.Drawing.Drawing2D.MatrixOrder.Append);
                transform.TransformPoints(m_pointFs);
                //e.Graphics.Transform = transform;
            }
            e.Graphics.DrawLine(new Pen(DrawColor, LineWidth), m_pointFs[0], m_pointFs[1]);
            base.OnPaint(e);
            Bitmap formBitmap = new Bitmap(this.Width, this.Height);
          //  this.DrawToBitmap(formBitmap, new Rectangle(0, 0, this.Width, this.Height));
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // LineXLD
            // 
            this.Name = "LineXLD";
            this.Size = new System.Drawing.Size(11480, 7220);
            this.ResumeLayout(false);

        }
    }
}
